<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:pe="http://primefaces.org/ui/extensions">
    <h:head>
        <title>#{bundle.loanprod}</title>
        <link href="./resources/css/default.css" rel="stylesheet" type="text/css" />
    </h:head>
    <h:body>
        <ui:composition>
            <h:form>
               <script type="text/javascript">  
                    function handleSaveLoanpord(xhr, status, args) {  
                        if(args.validationFailed || !args.success) {  
                            jQuery('#dialog').effect("shake", { times:3 }, 100);  
                        } else {  
                            dlgLoanprod.hide();  
                        }  
                    }

                    function handleDeleteLoanpord(xhr, status, args) {  
                        if(args.validationFailed || !args.success) {  
                            jQuery('#dialog').effect("shake", { times:3 }, 100);  
                        } else {  
                            dlcDeleteloanprod.hide();  
                        }  
                    }
                    
                </script>  

                <p:toolbar>
                    <p:toolbarGroup align="left">
                        <p:commandButton value="#{bundle.btnNew}" icon="ui-icon-document"
                                         rendered="#{menuBean.cekButtonAccess(361, 'INS;')}"
                                         action="#{loanprodBean.newData()}" oncomplete="dlgLoanprod.show()" 
                                         update=":#{utilityBean.findClientId('displayLoanprod')}" process="@this"> 
                            <pe:resetEditableValues for="displayLoanprod"/>
                        </p:commandButton>                                     

  
                        <p:commandButton value="#{bundle.btnOpen}" icon="ui-icon-disk" 
                                         rendered="#{menuBean.cekButtonAccess(361, 'OPN;')}"
                                     update=":#{utilityBean.findClientId('displayLoanprod')}"
                                     actionListener="#{loanprodBean.openData()}"   
                                     oncomplete="dlgLoanprod.show()" >
                        </p:commandButton>

                        <p:commandButton value="#{bundle.btnDelete}" icon="ui-icon-trash"
                                         onclick="dlcDeleteloanprod.show()"
                                         rendered="#{menuBean.cekButtonAccess(361, 'DEL;')}" /> 

                        <p:commandButton type="push" value="#{bundle.btnPrint}" icon="ui-icon-print"/>
                    </p:toolbarGroup>
                    
                </p:toolbar>
                
                <p:dataTable id="dtLoanprods" var="loanprod" value="#{loanprodBean.loanprods}"
                             selection="#{loanprodBean.selectedData}" selectionMode="single" 
                             rowKey="#{loanprod.loanprodId}" rowIndexVar="noUrut"
                             paginator="true" rows="10" paginatorPosition="bottom" resizableColumns="true"
                             paginatorTemplate="{CurrentPageReport} {PreviousPageLink} {NextPageLink}">
                    <p:column style="width: 10px;">
                        <f:facet name="header">No</f:facet>
                        <h:outputText value="#{noUrut+1}" />
                    </p:column>

                    <p:column style="width: 15px;" sortBy="#{loanprod.productNo}">
                        <f:facet name="header">#{bundle.productNo}</f:facet>
                        <h:outputText value="#{loanprod.productNo}" />
                    </p:column>

                    <p:column style="width: 150px;" sortBy="#{loanprod.productName}">
                        <f:facet name="header">#{bundle.globalName}</f:facet>
                        <h:outputText value="#{loanprod.productName}" />
                    </p:column>
                    
                    <p:column style="width: 80px;">
                        <f:facet name="header">#{bundle.lounchingDate}</f:facet>
                        <h:outputText value="#{loanprod.launchingDate}" />
                    </p:column>

                    <p:column style="width: 100px;">
                        <f:facet name="header">#{bundle.gpInslateDays}</f:facet>
                        <h:outputText styleClass="numPos" value="#{loanprod.gpInslateDays} #{bundle.day}" >
                            <f:convertNumber groupingUsed="true" />
                        </h:outputText>
                    </p:column>

                    <p:column style="width: 100px;">
                        <f:facet name="header">#{bundle.penaltyInslateRate}</f:facet>
                        <h:outputText styleClass="numPos" value="#{loanprod.penaltyInslateRate}  %" >
                            <f:convertNumber groupingUsed="true" />
                        </h:outputText>
                    </p:column>

                    <p:column style="width: 100px;">
                        <f:facet name="header">#{bundle.interestType}</f:facet>
                        <h:outputText styleClass="numPos" value="#{constantaBean.getInterestTypeText(loanprod.interestType)}" >
                            <f:convertNumber groupingUsed="true" />
                        </h:outputText>
                    </p:column>

                    <p:column style="width: 100px;">
                        <f:facet name="header">#{bundle.closingPenaltyRate}</f:facet>
                        <h:outputText styleClass="numPos" value="#{loanprod.closingPenaltyRate} %" >
                            <f:convertNumber groupingUsed="true" />
                        </h:outputText>
                    </p:column>
                </p:dataTable>
                                
                <!-- delete -->
                <p:confirmDialog message="#{bundle.confirmDelete}" appendToBody="true" 
                             header="#{bundle.confirmDeleteHeader}" severity="alert" widgetVar="dlcDeleteloanprod">
                    <h:panelGrid cellspacing="0" cellpadding="0" styleClass="pComBtnD">
                        <f:facet name="footer">
                            <p:commandButton value="#{bundle.btnYes}" update="dtLoanprods" process="@this" 
                                 oncomplete="handleDeleteLoanpord(xhr, status, args)"  
                                 actionListener="#{loanprodBean.delete()}" />  
                            <p:commandButton value="#{bundle.btnCancel}" onclick="dlcDeleteloanprod.hide()" type="button" /> 
                        </f:facet>
                    </h:panelGrid>
                </p:confirmDialog>
              </h:form>          
               <!-- entri/edit -->
                <p:dialog header="#{bundle.loanprod}" widgetVar="dlgLoanprod" closable="true" dynamic="true" modal="true" appendToBody="true">
                    <p:ajax event="close" listener="#{loanprodBean.handleClose}"/>
                     <h:form>
                    <h:panelGrid id="displayLoanprod" styleClass="addELIT">
                        <p:tabView activeIndex="0" rendered="#{loanprodBean.unsaveData!=null}">
                            <p:tab title="#{bundle.tabproduct}">
                                <h:panelGrid style="width:100%;">
                                    <h:panelGrid columns="3" style="padding:0 15px 0 0;" >
                                        <h:outputLabel value="#{bundle.productNo}" /><h:outputLabel value=" : " />
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0" >
                                            <p:inputText value="#{loanprodBean.unsaveData.productNo}" style="width: 15px;" 
                                                        id="loanprodProductNo1" label="Product No"
                                                        requiredMessage="#{bundle.productNo} #{bundle.requiredInput}"
                                                        required="true" >
                                                <p:ajax update="msgloanprodProductNo1" process="@this"/>
                                            </p:inputText>
                                            <p:message id="msgloanprodProductNo1" for="loanprodProductNo1" display="icon" />
                                        </h:panelGrid>

                                        <h:outputLabel value= "#{bundle.globalName}" /><h:outputLabel value=" : " />
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0" >
                                            <p:inputText value="#{loanprodBean.unsaveData.productName}" size="25" 
                                                        id="loanprodProductName1" label="#{bundle.globalName}"
                                                        requiredMessage="#{bundle.globalName} #{bundle.requiredInput}" required="true">
                                                <p:ajax update="msgloanprodProductName1" process="@this" />
                                            </p:inputText>
                                            <p:message id="msgloanprodProductName1" for="loanprodProductName1" display="icon" />
                                        </h:panelGrid>
                                        
                                        <h:outputLabel value= "#{bundle.aliasName}" /><h:outputLabel value=" : " />
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0" >
                                            <p:inputText value="#{loanprodBean.unsaveData.aliasName}" size="25" 
                                                        id="loanprodAliasName" label="#{bundle.aliasName}"
                                                        requiredMessage="#{bundle.aliasName} #{bundle.requiredInput}" required="true">
                                                <p:ajax update="msgloanprodAliasName" process="@this" />
                                            </p:inputText>
                                            <p:message id="msgloanprodAliasName" for="loanprodAliasName" display="icon" />
                                        </h:panelGrid>

                                        <h:outputLabel value= "#{bundle.lounchingDate}" /><h:outputLabel value=" : " />
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0" >
                                            <p:calendar value="#{loanprodBean.unsaveData.launchingDate}" pattern="dd/MM/yyyy" showOn="button"
                                                        size="8" required="true" id="loanprodLounchingDate1" label="#{bundle.lounchingDate}"
                                                        requiredMessage="#{bundle.lounchingDate} #{bundle.requiredInput}" >
                                                <p:ajax update="msgloanprodLounchingDate1" />
                                            </p:calendar>
                                            <p:message id="msgloanprodLounchingDate1" for="loanprodLounchingDate1" display="icon" />
                                        </h:panelGrid>

                                        <h:outputLabel style="padding:0 15px 0 0;" value= "#{bundle.gpInslateDays}" /><h:outputLabel value=" : " />
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0" >
                                            <pe:inputNumber decimalSeparator="." thousandSeparator="," maxValue="9999" minValue="0" 
                                                    symbol=" #{bundle.day}" symbolPosition="s"
                                                    styleClass="integer" value="#{loanprodBean.unsaveData.gpInslateDays}"
                                                    label="#{bundle.gpInslateDays}" id="loanprodgpInslateDays1" required="true"
                                                    requiredMessage="#{bundle.gpInslateDays} #{bundle.requiredInput}" >
                                                <p:ajax update="msgloanprodgpInslateDays1" />
                                            </pe:inputNumber> 
                                            <p:message id="msgloanprodgpInslateDays1" for="loanprodgpInslateDays1" display="icon" />
                                        </h:panelGrid>

                                        <h:outputLabel value= "#{bundle.penaltyInslateRate}" /><h:outputLabel value=" : " />
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0" >
                                            <pe:inputNumber decimalSeparator="." thousandSeparator="," maxValue="999.99" minValue="0" 
                                                        symbol=" %" symbolPosition="s"
                                                        styleClass="percent" value="#{loanprodBean.unsaveData.penaltyInslateRate}"
                                                        label="#{bundle.penaltyInslateRate}" id="savdepopenaltyInslateRate1" required="true"
                                                        requiredMessage="#{bundle.penaltyInslateRate} #{bundle.requiredInput}" >
                                                <p:ajax update="msgsavdepopenaltyInslateRate1" />
                                            </pe:inputNumber>
                                            <p:message id="msgsavdepopenaltyInslateRate1" for="savdepopenaltyInslateRate1" display="icon" />
                                        </h:panelGrid>

                                        <h:outputLabel value= "#{bundle.interestType}" /><h:outputLabel value=" : " />
                                        <p:selectOneMenu  value="#{loanprodBean.unsaveData.interestType}" style="width: 170px">
                                            <f:selectItem itemValue="F" itemLabel="#{bundle.interestTypeFlat}"/>
                                            <f:selectItem itemValue="E" itemLabel="#{bundle.interestTypeEffective}"/>
                                        </p:selectOneMenu>

                                        <h:outputLabel value= "#{bundle.closingPenaltyRate}" /><h:outputLabel value=" : " />
                                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0" >
                                            <pe:inputNumber decimalSeparator="." thousandSeparator="," maxValue="999.99" minValue="0" 
                                                        symbol=" %" symbolPosition="s"
                                                styleClass="percent" value="#{loanprodBean.unsaveData.closingPenaltyRate}"
                                                        label="#{bundle.closingPenaltyRate}"
                                                        id="savdepoclosingPenaltyRate1" required="true"
                                                        requiredMessage="#{bundle.closingPenaltyRate} #{bundle.requiredInput}">
                                                <p:ajax update="msgsavdepoclosingPenaltyRate1" process="@this"/>
                                            </pe:inputNumber>
                                            <p:message id="msgsavdepoclosingPenaltyRate1" for="savdepoclosingPenaltyRate1" display="icon" />
                                        </h:panelGrid>

                                        <h:outputLabel value= "#{bundle.suspended}" /><h:outputLabel value=" : " />
                                        <p:selectBooleanCheckbox  value="#{loanprodBean.unsaveData.suspended}" />

                                        <h:outputLabel value= "#{bundle.suspendDate}" /><h:outputLabel value=" : " />
                                        <p:calendar  value="#{loanprodBean.unsaveData.suspendedDate}" pattern="dd/MM/yyyy" size="8" showOn="button"/>
                                    </h:panelGrid>
                                </h:panelGrid>
                            </p:tab>

                            <p:tab title="#{bundle.intRate}" >
                                <pe:masterDetail id="loanprodrateMD1" selectLevelListener="#{selectLevelListener.handleNavigation}" style="width: 500px;" >
                                    <pe:masterDetailLevel level="1" levelLabel="#{bundle.loanprodrate}" >
                                        <p:outputPanel autoUpdate="true">
                                            <p:dataTable id="dtLoanprodRates" var="prodetail" value="#{loanprodBean.unsaveData.loanprodrates}"
                                                         rowIndexVar="noUrut" >
                                                <p:column style="width: 15px;">
                                                    <f:facet name="header">No</f:facet>
                                                    <h:outputText value="#{noUrut+1}" styleClass="numPos" >
                                                        <f:convertNumber groupingUsed="true"/>
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="width: 80px;">
                                                    <f:facet name="header">#{bundle.fromAmont}</f:facet>
                                                    <h:outputText value="#{prodetail.fromAmount}" styleClass="numPos" >
                                                        <f:convertNumber groupingUsed="true"/>
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="width:auto;">
                                                    <f:facet name="header">#{bundle.toAmont}</f:facet>
                                                    <h:outputText value="#{prodetail.toAmount}" styleClass="numPos" >
                                                        <f:convertNumber groupingUsed="true"/>
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="width:80px">
                                                    <f:facet name="header">#{bundle.interestRate}</f:facet>
                                                    <h:outputText value="#{prodetail.interestRate}" styleClass="numPos" >
                                                        <f:convertNumber groupingUsed="true"/>
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="width:80px">
                                                    <f:facet name="header">Actions</f:facet>
                                                    <p:commandLink value="Add" actionListener="#{loanprodBean.newDetailRate()}" >
                                                        <pe:selectDetailLevel contextValue="#{null}" preserveInputs="true"/>
                                                    </p:commandLink><p:spacer width="5"/>

                                                    <p:commandLink value="Edit" actionListener="#{loanprodBean.editDetailRate(prodetail)}" disabled="#{prodetail.interestRate==null}">
                                                        <pe:selectDetailLevel contextValue="#{prodetail}" preserveInputs="true"/>
                                                    </p:commandLink><p:spacer width="5"/>

                                                    <p:commandLink value="Del" actionListener="#{loanprodBean.handleRemoveDetailRate}" disabled="#{prodetail.interestRate==null}">
                                                        <p:collector value="#{prodetail}" removeFrom="#{loanprodBean.unsaveData.loanprodrates}" />
                                                    </p:commandLink>
                                                </p:column>
                                            </p:dataTable>
                                        </p:outputPanel>
                                    </pe:masterDetailLevel>

                                    <pe:masterDetailLevel level="2" levelLabel="Add/edit" contextVar="prodetail" >
                                        <h:panelGrid id="frmLoanprodratedetail" columns="3" border="0" cellpadding="0" cellspacing="3" >
                                            <h:outputLabel value= "#{bundle.fromAmont}" /><h:outputLabel value=":"/>
                                            <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                                <pe:inputNumber decimalSeparator="." thousandSeparator="," maxValue="99999999999999999999.99" minValue="0" 
                                                    styleClass="money" value="#{loanprodBean.unsaveProdrate.fromAmount}" style="width: 150px;"
                                                    id="loanprodrateFromAmount" required="true" label="#{bundle.fromAmont}"
                                                    requiredMessage="#{bundle.fromAmont} #{bundle.requiredInput}">
                                                    <p:ajax update="msgloanprodrateFromAmount" process="@this" />
                                                </pe:inputNumber>
                                                <p:message id="msgloanprodrateFromAmount" for="loanprodrateFromAmount" display="icon" />
                                            </h:panelGrid>

                                            <h:outputLabel value= "#{bundle.toAmont}" /><h:outputLabel value=":"/>
                                            <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                                <pe:inputNumber decimalSeparator="." thousandSeparator="," maxValue="99999999999999999999.99" minValue="0" 
                                                    styleClass="money" value="#{loanprodBean.unsaveProdrate.toAmount}" style="width: 150px;"
                                                    id="loanprodrateToAmount" required="true" label="#{bundle.toAmont}"
                                                    requiredMessage="#{bundle.toAmont} #{bundle.requiredInput}">
                                                    <p:ajax update="msgloanprodrateToAmount" process="@this" />
                                                </pe:inputNumber>
                                                <p:message id="msgloanprodrateToAmount" for="loanprodrateToAmount" display="icon" />
                                            </h:panelGrid>

                                            <h:outputLabel value= "#{bundle.interestRate}" /><h:outputLabel value=":"/>
                                            <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                                <pe:inputNumber decimalSeparator="." thousandSeparator="," maxValue="999.99" minValue="0" 
                                                        symbol=" %" symbolPosition="s"
                                                    styleClass="percent" value="#{loanprodBean.unsaveProdrate.interestRate}" style="width: 150px;"
                                                    id="loanprodrateInterestRate" required="true" label="#{bundle.interestRate}"
                                                    requiredMessage="#{bundle.interestRate} #{bundle.requiredInput}">
                                                    <p:ajax update="msgloanprodrateInterestRate" process="@this" />
                                                </pe:inputNumber>
                                                <p:message id="msgloanprodrateInterestRate" for="loanprodrateInterestRate" display="icon" />
                                            </h:panelGrid>
                                        </h:panelGrid>

                                        <h:panelGrid cellpadding="0" cellspacing="0" border="0" >
                                            <f:facet name="footer">
                                                <p:commandButton value="Back" icon="ui-icon ui-icon-arrowthick-1-w" process="@this">
                                                    <pe:resetEditableValues for="frmLoanprodratedetail"/>
                                                    <pe:selectDetailLevel step="-1"/>
                                                </p:commandButton>

                                                <p:commandButton value="#{bundle.btnSave}" icon="ui-icon-disk" actionListener="#{loanprodBean.saveDetailRate()}"/>

                                                <p:commandButton value="#{bundle.btnNew}" icon="ui-icon-document" actionListener="#{loanprodBean.newDetailRate()}" 
                                                                 process="@this" update="frmLoanprodratedetail">
                                                    <pe:resetEditableValues for="frmLoanprodratedetail"/>
                                                </p:commandButton>
                                            </f:facet>
                                        </h:panelGrid>
                                    </pe:masterDetailLevel>
                                </pe:masterDetail>

                            </p:tab>

                            <p:tab title="#{bundle.fee}" >
                                <pe:masterDetail id="loanprodfeeMD" selectLevelListener="#{selectLevelListener.handleNavigation}" style="width: 500px;">
                                    <pe:masterDetailLevel level="1" levelLabel="#{bundle.loanprodfee}">

                                        <p:outputPanel autoUpdate="true">
                                            <p:dataTable id="dtLoanprodfees" var="fee" value="#{loanprodBean.unsaveData.loanprodfees}" rowIndexVar="noUrut3">
                                                <p:column style="width: 15px;">
                                                    <f:facet name="header">No</f:facet>
                                                    <h:outputText value="#{noUrut+1}" styleClass="numPos" >
                                                        <f:convertNumber groupingUsed="true"/>
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="width:auto;">
                                                    <f:facet name="header">#{bundle.loanfee}</f:facet>
                                                    <h:outputText value="#{loanprodBean.selectItemValueOf(loanprodBean.avaibleFee, fee.feeId)}" />
                                                </p:column>

                                                <p:column style="width:90px;">
                                                    <f:facet name="header">Actions</f:facet>
                                                    <p:commandLink value="Add" actionListener="#{loanprodBean.newDetailFee()}" >
                                                        <pe:selectDetailLevel contextValue="#{null}" preserveInputs="true"/>
                                                    </p:commandLink><p:spacer width="3"/>

                                                    <p:commandLink value="Edit" actionListener="#{loanprodBean.editDetailFee(fee)}" disabled="#{fee.feeId ==null}">
                                                        <pe:selectDetailLevel contextValue="#{fee}" preserveInputs="true"/>
                                                    </p:commandLink><p:spacer width="3"/>

                                                    <p:commandLink value="Del" actionListener="#{loanprodBean.handleRemoveDetailFee}" disabled="#{fee.feeId ==null}">
                                                        <p:collector value="#{fee}" removeFrom="#{loanprodBean.unsaveData.loanprodfees}" />  
                                                    </p:commandLink>
                                                </p:column>
                                            </p:dataTable>
                                        </p:outputPanel>
                                    </pe:masterDetailLevel>

                                    <pe:masterDetailLevel level="2" levelLabel="Add/edit" contextVar="fee" >
                                        <h:panelGrid id="frmLoanprodfee" columns="3" border="0" cellpadding="0" cellspacing="10" >
                                            <h:outputLabel value= "#{bundle.loanfee}" /><h:outputLabel value=":"/>
                                            <p:selectOneMenu value="#{loanprodBean.feeId}" style="width: 170px;" >
                                                <f:selectItems value="#{loanprodBean.avaibleFee}" />
                                            </p:selectOneMenu>
                                        </h:panelGrid>

                                        <h:panelGrid cellpadding="0" >
                                            <f:facet name="footer">
                                                <p:commandButton value="Back" icon="ui-icon ui-icon-arrowthick-1-w" process="@this">
                                                    <pe:resetEditableValues for="frmLoanprodfee"/>  
                                                    <pe:selectDetailLevel step="-1"/>
                                                </p:commandButton>

                                                <p:commandButton value="#{bundle.btnSave}" icon="ui-icon-disk" actionListener="#{loanprodBean.saveDetailFee()}"/>

                                                <p:commandButton value="#{bundle.btnNew}" icon="ui-icon-document" actionListener="#{loanprodBean.newDetailFee()}" 
                                                                 process="@this" update="frmLoanprodfee">
                                                    <pe:resetEditableValues for="frmLoanprodfee"/>
                                                </p:commandButton>  
                                            </f:facet>
                                        </h:panelGrid>

                                    </pe:masterDetailLevel>
                                </pe:masterDetail>
                            </p:tab>

                            <p:tab title="#{bundle.collateral}" >
                                <pe:masterDetail id="loanprodrateMD2" selectLevelListener="#{selectLevelListener.handleNavigation}" style="width: 500px;">
                                    <pe:masterDetailLevel level="1" levelLabel="#{bundle.loanprodcoral}">

                                        <p:outputPanel autoUpdate="true">
                                            <p:dataTable id="dtLoanprodCoral" var="coral" value="#{loanprodBean.unsaveData.loanprodcorals}" rowIndexVar="noUrut">
                                                <p:column style="width: 15px;">
                                                    <f:facet name="header">No</f:facet>
                                                    <h:outputText value="#{noUrut+1}" styleClass="numPos" >
                                                        <f:convertNumber groupingUsed="true"/>
                                                    </h:outputText>
                                                </p:column>

                                                <p:column style="width:auto;">
                                                    <f:facet name="header">#{bundle.collateral}</f:facet>
                                                    <h:outputText value="#{loanprodBean.selectItemValueOf(loanprodBean.avaibleCoral,coral.collateralId)}" />
                                                </p:column>

                                                <p:column style="width:80px;">
                                                    <f:facet name="header">Actions</f:facet>
                                                    <p:commandLink value="Add" actionListener="#{loanprodBean.newDetailCoral()}" >
                                                        <pe:selectDetailLevel contextValue="#{null}" preserveInputs="true"/>
                                                    </p:commandLink><p:spacer width="5"/>

                                                    <p:commandLink value="Edit" actionListener="#{loanprodBean.editDetailCoral(coral)}" disabled="#{coral.collateralId ==null}">
                                                        <pe:selectDetailLevel contextValue="#{coral}" preserveInputs="true"/>
                                                    </p:commandLink><p:spacer width="5"/>

                                                    <p:commandLink value="Del" actionListener="#{loanprodBean.handleRemoveDetailCoral}" disabled="#{coral.collateralId ==null}">
                                                        <p:collector value="#{coral}" removeFrom="#{loanprodBean.unsaveData.loanprodcorals}" />  
                                                    </p:commandLink>
                                                </p:column>
                                            </p:dataTable>
                                        </p:outputPanel>
                                    </pe:masterDetailLevel>

                                    <pe:masterDetailLevel level="2" levelLabel="Add/edit" contextVar="coral" >
                                        <h:panelGrid id="frmLoanprodcoraldetail" columns="3" border="0" cellpadding="0" cellspacing="10" >
                                            <h:outputLabel value= "#{bundle.collateral}" /><h:outputLabel value=":"/>
                                            <p:selectOneMenu value="#{loanprodBean.colateralId}" style="width: 170px;" >
                                                <f:selectItems value="#{loanprodBean.avaibleCoral}" />
                                            </p:selectOneMenu>
                                        </h:panelGrid>

                                        <h:panelGrid cellpadding="0" >
                                            <f:facet name="footer">
                                                <p:commandButton value="Back" icon="ui-icon ui-icon-arrowthick-1-w" process="@this">
                                                    <pe:resetEditableValues for="frmLoanprodcoraldetail"/>  
                                                    <pe:selectDetailLevel step="-1"/>
                                                </p:commandButton>

                                                <p:commandButton value="#{bundle.btnSave}" icon="ui-icon-disk" actionListener="#{loanprodBean.saveDetailCoral()}"/>

                                                <p:commandButton value="#{bundle.btnNew}" icon="ui-icon-document" actionListener="#{loanprodBean.newDetailCoral()}" 
                                                                 process="@this" update="frmLoanprodcoraldetail">
                                                    <pe:resetEditableValues for="frmLoanprodcoraldetail"/>  
                                                </p:commandButton>  
                                            </f:facet>
                                        </h:panelGrid>
                                    </pe:masterDetailLevel>
                                </pe:masterDetail>
                            </p:tab>
                                                                
                            <p:tab title="#{bundle.tabproductDetail}" >
                                <h:panelGrid columns="3" style="width:100%;" >
                                    <h:outputLabel value= "#{bundle.principalGlaccnt}" /><h:outputLabel value= " : " />
                                    <p:selectOneMenu  value="#{loanprodBean.principalGL}" style="width: 300px;" var="glacc1" converter="glaccnt">
                                        <f:selectItem rendered="#{loanprodBean.principalGL!=null}" itemLabel="#{loanprodBean.principalGL.accountName}" itemValue="#{loanprodBean.principalGL}" />
                                        <f:selectItems value="#{loanprodBean.avblGL}" var="gl" itemLabel="#{gl.accountName}" itemValue="#{gl}" />
                                        <p:column>#{glacc1.accountNo}</p:column>
                                        <p:column>#{glacc1.accountName}</p:column>
                                    </p:selectOneMenu>

                                    <h:outputLabel value= "#{bundle.interestGlccnt}" /><h:outputLabel value= " : " />
                                    <p:selectOneMenu  value="#{loanprodBean.interestGL}" style="width: 300px;" var="glacc2" converter="glaccnt">
                                        <f:selectItem rendered="#{loanprodBean.interestGL!=null}" itemLabel="#{loanprodBean.interestGL.accountName}" itemValue="#{loanprodBean.interestGL}" />
                                        <f:selectItems value="#{loanprodBean.avblGL}" var="gl" itemLabel="#{gl.accountName}" itemValue="#{gl}" />
                                        <p:column>#{glacc2.accountNo}</p:column>
                                        <p:column>#{glacc2.accountName}</p:column>
                                    </p:selectOneMenu>

                                    <h:outputLabel value= "#{bundle.disctIntrGlaccnt}" /><h:outputLabel value= " : " />
                                    <p:selectOneMenu  value="#{loanprodBean.discIntrGL}" style="width: 300px;"  var="glacc3" converter="glaccnt">
                                        <f:selectItem rendered="#{loanprodBean.discIntrGL!=null}" itemLabel="#{loanprodBean.discIntrGL.accountName}" itemValue="#{loanprodBean.discIntrGL}" />
                                        <f:selectItems value="#{loanprodBean.avblGL}" var="gl" itemLabel="#{gl.accountName}" itemValue="#{gl}" />
                                        <p:column>#{glacc3.accountNo}</p:column>
                                        <p:column>#{glacc3.accountName}</p:column>
                                    </p:selectOneMenu>
                                        
                                    <h:outputLabel value= "#{bundle.accruedIntrGlaccnt}" /><h:outputLabel value= " : " />
                                    <p:selectOneMenu  value="#{loanprodBean.accruedIntrGL}" style="width: 300px;"  var="glacc4" converter="glaccnt">
                                        <f:selectItem rendered="#{loanprodBean.accruedIntrGL!=null}" itemLabel="#{loanprodBean.accruedIntrGL.accountName}" itemValue="#{loanprodBean.accruedIntrGL}" />
                                        <f:selectItems value="#{loanprodBean.avblGL}" var="gl" itemLabel="#{gl.accountName}" itemValue="#{gl}" />
                                        <p:column>#{glacc4.accountNo}</p:column>
                                        <p:column>#{glacc4.accountName}</p:column>
                                    </p:selectOneMenu>
                                    
                                    <h:outputLabel value= "#{bundle.accruedPenaltyGlaccnt}" /><h:outputLabel value= " : " />
                                    <p:selectOneMenu  value="#{loanprodBean.accruedPenaltyGL}" style="width: 300px;"  var="glacc5" converter="glaccnt">
                                        <f:selectItem rendered="#{loanprodBean.accruedPenaltyGL!=null}" itemLabel="#{loanprodBean.accruedPenaltyGL.accountName}" itemValue="#{loanprodBean.accruedPenaltyGL}" />
                                        <f:selectItems value="#{loanprodBean.avblGL}" var="gl" itemLabel="#{gl.accountName}" itemValue="#{gl}" />
                                        <p:column>#{glacc5.accountNo}</p:column>
                                        <p:column>#{glacc5.accountName}</p:column>
                                    </p:selectOneMenu>

                                    <h:outputLabel value= "#{bundle.intrIncomeGlaccnt}" /><h:outputLabel value= " : " />
                                    <p:selectOneMenu  value="#{loanprodBean.intrIncomeGL}" style="width: 300px;"  var="glacc6" converter="glaccnt">
                                        <f:selectItem rendered="#{loanprodBean.intrIncomeGL!=null}" itemLabel="#{loanprodBean.intrIncomeGL.accountName}" itemValue="#{loanprodBean.intrIncomeGL}" />
                                        <f:selectItems value="#{loanprodBean.avblGL}" var="gl" itemLabel="#{gl.accountName}" itemValue="#{gl}" />
                                        <p:column>#{glacc6.accountNo}</p:column>
                                        <p:column>#{glacc6.accountName}</p:column>
                                    </p:selectOneMenu>

                                    <h:outputLabel value= "#{bundle.penaltyIncomeGlaccnt}" /><h:outputLabel value= " : " />
                                    <p:selectOneMenu  value="#{loanprodBean.penaltyIncomeGL}" style="width: 300px;" var="glacc7" converter="glaccnt">
                                        <f:selectItem rendered="#{loanprodBean.penaltyIncomeGL!=null}" itemLabel="#{loanprodBean.penaltyIncomeGL.accountName}" itemValue="#{loanprodBean.penaltyIncomeGL}" />
                                        <f:selectItems value="#{loanprodBean.avblGL}" var="gl" itemLabel="#{gl.accountName}" itemValue="#{gl}" />
                                        <p:column>#{glacc7.accountNo}</p:column>
                                        <p:column>#{glacc7.accountName}</p:column>
                                    </p:selectOneMenu>

                                    <h:outputLabel value= "#{bundle.feeIncomeGlaccnt}" /><h:outputLabel value= " : " />
                                    <p:selectOneMenu  value="#{loanprodBean.feeIncomeGL}" style="width: 300px;" var="glacc8" converter="glaccnt">
                                        <f:selectItem rendered="#{loanprodBean.feeIncomeGL!=null}" itemLabel="#{loanprodBean.feeIncomeGL.accountName}" itemValue="#{loanprodBean.feeIncomeGL}" />
                                        <f:selectItems value="#{loanprodBean.avblGL}" var="gl" itemLabel="#{gl.accountName}" itemValue="#{gl}" />
                                        <p:column>#{glacc8.accountNo}</p:column>
                                        <p:column>#{glacc8.accountName}</p:column>
                                    </p:selectOneMenu>

                                    <h:outputLabel value= "#{bundle.woPrincipleGlaccnt}" /><h:outputLabel value= " : " />
                                    <p:selectOneMenu  value="#{loanprodBean.woPrincipleGL}" style="width: 300px;" var="glacc9" converter="glaccnt">
                                        <f:selectItem rendered="#{loanprodBean.woPrincipleGL!=null}" itemLabel="#{loanprodBean.woPrincipleGL.accountName}" itemValue="#{loanprodBean.woPrincipleGL}" />
                                        <f:selectItems value="#{loanprodBean.avblGL}" var="gl" itemLabel="#{gl.accountName}" itemValue="#{gl}" />
                                        <p:column>#{glacc9.accountNo}</p:column>
                                        <p:column>#{glacc9.accountName}</p:column>
                                    </p:selectOneMenu>

                                    <h:outputLabel value= "#{bundle.woIntrGlaccnt}" /><h:outputLabel value= " : " />
                                    <p:selectOneMenu  value="#{loanprodBean.woIntrGL}" style="width: 300px;" var="glacc10" converter="glaccnt">
                                        <f:selectItem rendered="#{loanprodBean.woIntrGL!=null}" itemLabel="#{loanprodBean.woIntrGL.accountName}" itemValue="#{loanprodBean.woIntrGL}" />
                                        <f:selectItems value="#{loanprodBean.avblGL}" var="gl" itemLabel="#{gl.accountName}" itemValue="#{gl}" />
                                        <p:column>#{glacc10.accountNo}</p:column>
                                        <p:column>#{glacc10.accountName}</p:column>
                                    </p:selectOneMenu>

                                    <h:outputLabel value= "#{bundle.woPenaltyGlaccnt}" /><h:outputLabel value= " : " />
                                    <p:selectOneMenu  value="#{loanprodBean.woPenaltyGL}" style="width: 300px;" var="glacc11" converter="glaccnt"
                                                      editable="true" >
                                        <f:selectItem rendered="#{loanprodBean.woPenaltyGL!=null}" itemLabel="#{loanprodBean.woPenaltyGL.accountName}" itemValue="#{loanprodBean.woPenaltyGL}" />
                                        <f:selectItems value="#{loanprodBean.avblGL}" var="gl" itemLabel="#{gl.accountName}" itemValue="#{gl}" />
                                        <p:column>#{glacc11.accountNo}</p:column>
                                        <p:column>#{glacc11.accountName}</p:column>
                                    </p:selectOneMenu>
                                </h:panelGrid>
                            </p:tab>
                        </p:tabView>
                    </h:panelGrid>

                    <h:panelGrid cellpadding="0" styleClass="pComBtnSTDR">
                        <f:facet name="footer">
                            <p:commandButton value="#{bundle.btnSave}" icon="ui-icon-disk" actionListener="#{loanprodBean.trySave()}"
                                             update="displayLoanprod, :#{utilityBean.findClientId('dtLoanprods')}" id="submitLoanprod"
                                             oncomplete="handleSaveLoanpord(xhr, status, args)"/>
                            <p:commandButton value="#{bundle.btnClose}" oncomplete="dlgLoanprod.hide()" icon="ui-icon-document" process="@this">
                                <pe:resetEditableValues for="displayLoanprod"/>  
                            </p:commandButton>
                        </f:facet>
                    </h:panelGrid>
                    <p:defaultCommand target="submitLoanprod" /> 
                     </h:form>
                </p:dialog>
                
           
        </ui:composition>     
    </h:body>
</html>
